package com.vhall.component.service.export.handler;

import com.vhall.component.entity.export.ExportEntity;
import com.vhall.component.entity.export.dto.AdminExportDocumentQueryCondition;
import com.vhall.component.service.interactive.DocumentsInnerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * admin-文档导出
 *
 * @author yuanzh
 */
@Slf4j
@Component("adminExportHandler_2")
public class AdminExportDocumentHandler implements BaseAdminExportHandler {

    private static final String FILE_NAME = "文档列表";

    @Autowired
    private DocumentsInnerService documentsInnerService;

    @Override
    public String getFileName() {
        return FILE_NAME;
    }

    @Override
    public int count(ExportEntity entity) {
        AdminExportDocumentQueryCondition condition = AdminExportDocumentQueryCondition.convertTo(entity.getParams());
        return documentsInnerService.countForAdminExport(condition);
    }
}
